package com.example.demo.core.handler;

import com.example.demo.core.handler.exception.ExceptionInfoBO;
import com.example.demo.core.handler.exception.ResultBO;
import com.example.demo.core.handler.exception.ResultTool;
import io.jsonwebtoken.SignatureException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class PermissionHandler {
    @ExceptionHandler(value = { SignatureException.class })
    @ResponseBody
    public ResultBO<?> authorizationException(SignatureException e){
        return ResultTool.error(new ExceptionInfoBO(401,e.getMessage()));
    }
}